Skip to content

Cleanup/api pass - #173

Merged
Xarlos89 merged 13 commits into
masterfrom
cleanup/api-pass
Aug 23, 2026
Merged

Cleanup/api pass#173
Xarlos89 merged 13 commits into
masterfrom
cleanup/api-pass

Conversation

@Xarlos89

Copy link
Copy Markdown
Collaborator

A full cleanup pass over the Flask API.
The API now uses a connection pool instead of a single psycopg connection, every route returns a correct HTTP status code, and the responses are consistent across all endpoints. Every cog was updated to the new response, and a pytest suite covering the routes was added and slammed into CI.

Fixes the long-standing jsonify(data, status_code) bug — that call serialised the status code into the body as a JSON array and always returned HTTP 200, which is why cogs were indexing responses as result[0]["logging"][2].

Closes #134

Comment thread src/api/routes/_responses.py
Comment thread src/api/api.py
Comment thread src/bot/cogs/verification/verification_dropdown.py
Comment thread src/bot/cogs/verification/verification_on_join.py
Comment thread src/api/core/db_helper.py

@JefeThePug JefeThePug left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I've added a few comments here and there. Also some of the docker stuff is a bit over my head so I skipped it, but the python is good :)

@Xarlos89
Xarlos89 merged commit 16cb0c5 into master Aug 23, 2026
2 checks passed
Xarlos89 added a commit that referenced this pull request Aug 23, 2026
* add `/link_to` slash command

* ran pre-commit post commit

* Fix type annotation of WEBPAGE_CHOICES

* Change WEBPAGE_CHOICES from list to tuple

* Remove unnecessary constant

* Cleanup/api pass (#173)

* clean up the API <-> db helper

* API modifications and improvements

* update dockerfile entrypoint

* Update logging cogs

* Update moderation cogs

* Update verification cogs

* Update admin cogs

* Update feature cogs

* tests!

* update postman collection

* fixing tests so they work!

* fix pre-commit

* exclude tests from pre-commit in CI + .env.EXAMPLE updates

* Update actions/setup-python action to v7 (#171)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* add `/link_to` slash command

* ran pre-commit post commit

* Fix type annotation of WEBPAGE_CHOICES

* Change WEBPAGE_CHOICES from list to tuple

* Remove unnecessary constant

* remove newline

for ruff check

---------

Co-authored-by: Krish <101330162+Jiggly-Balls@users.noreply.github.com>
Co-authored-by: Xarlos <57622136+Xarlos89@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@Xarlos89
Xarlos89 deleted the cleanup/api-pass branch August 23, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: API routes return malformed JSON — jsonify(data, status_code) should be jsonify(data), status_code

2 participants